package com.hd.openapi.servies.serviceimpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hd.openapi.common.ResponseResult;
import com.hd.openapi.common.ResultTable;
import com.hd.openapi.dao.ApiSystemparamMapper;
import com.hd.openapi.entity.ApiSystemparam;
import com.hd.openapi.servies.sysser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class sysserIMPL implements sysser {
    @Autowired
    private ApiSystemparamMapper as;

    @Override
    public ResultTable getdata(Integer page, Integer limit, String name, String state) {
        PageHelper.startPage (page,limit);
        List<ApiSystemparam> i= as.getdataad(name,state);
        PageInfo a=new PageInfo (i);
        return new ResultTable (0,"",(int)a.getTotal (),a.getList ());
    }

    @Override
    public ResponseResult deldata(Integer[] ids) {
        int i=as.delda(ids);
        return ResponseResult.getSuccess ();
    }

    @Override
    public ResponseResult adddata(ApiSystemparam apiSystemparam) {
        int ii=as.insertSelective (apiSystemparam);
        return ResponseResult.getSuccess ();
    }

    @Override
    public ResponseResult updatadata(ApiSystemparam apiSystemparam) {
       int ii=as.updateByPrimaryKeySelective (apiSystemparam);
        return ResponseResult.getSuccess ();
    }
}
